home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- /*************************************************************************
- *
- * WButton -- Base class for the Windows 95 button controls.
- *
- *
- * Events:
- *
- * Click --
- *
- * DoubleClick --
- *
- *************************************************************************/
-
- #ifndef _WBUTTON_HPP_INCLUDED
- #define _WBUTTON_HPP_INCLUDED
- #pragma once
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WCONTROL_HPP_INCLUDED
- # include "wcontrol.hpp"
- #endif
-
- #include "wevent.hpp"
-
- enum WButtonStateValues {
- WBStateNotChecked = 0x00000000,
- WBStateNotSet = WBStateNotChecked,
-
- WBStateChecked = 0x00000001,
- WBStateSet = WBStateChecked,
-
- WBStateIndeterminate = 0x00000002,
- WBStatePushed = 0x00000004, /* BST_PUSHED */
- WBStateFocus = 0x00000008 /* BST_FOCUS */
-
- };
- typedef WULong WButtonState;
-
-
- //
- // Button styles
- //
-
- #define WBSDefault ((WStyle)0x50000000L) // WS_VISIBLE|WS_CHILD
- #define WBSRightButton ((WStyle)0x00000020L) // BS_RIGHTBUTTON
- #define WBSIcon ((WStyle)0x00000040L) // BS_ICON
- #define WBSBitmap ((WStyle)0x00000080L) // BS_BITMAP
- #define WBSLeft ((WStyle)0x00000100L) // BS_LEFT
- #define WBSRight ((WStyle)0x00000200L) // BS_RIGHT
- #define WBSCenter ((WStyle)0x00000300L) // BS_CENTER
- #define WBSTop ((WStyle)0x00000400L) // BS_TOP
- #define WBSBottom ((WStyle)0x00000800L) // BS_BOTTOM
- #define WBSVCenter ((WStyle)0x00000C00L) // BS_VCENTER
- #define WBSPushLike ((WStyle)0x00001000L) // BS_PUSHLIKE
- #define WBSMultiline ((WStyle)0x00002000L) // BS_MULTILINE
- #define WBSNotify ((WStyle)0x00004000L) // BS_NOTIFY
- #define WBSFlat ((WStyle)0x00008000L) // BS_FLAT
-
- // Types of button
- // Note: These style are mutually exclusive
-
- #define WBSPushButton ((WStyle)0x00000000L) // BS_PUSHBUTTON
- #define WBSDefPushButton ((WStyle)0x00000001L) // BS_DEFPUSHBUTTON
- #define WBSCheckBox ((WStyle)0x00000002L) // BS_CHECKBOX
- #define WBSAutoCheckBox ((WStyle)0x00000003L) // BS_AUTOCHECKBOX
- #define WBSRadioButton ((WStyle)0x00000004L) // BS_RADIOBUTTON
- #define WBSThreeState ((WStyle)0x00000005L) // BS_3STATE
- #define WBS3State ((WStyle)0x00000005L) // BS_3STATE
- #define WBSAutoThreeState ((WStyle)0x00000006L) // BS_AUTO3STATE
- #define WBSAuto3State ((WStyle)0x00000006L) // BS_AUTO3STATE
- #define WBSAutoRadioButton ((WStyle)0x00000009L) // BS_AUTORADIOBUTTON
- #define WBSOwnerDraw ((WStyle)0x0000000BL) // BS_OWNERDRAW
- #define WBSGroupBox ((WStyle)0x00000007L) // BS_GROUPBOX
-
- class WCMCLASS WButton : public WControl {
- WDeclareSubclass( WButton, WControl )
-
- public:
-
- /**********************************************************
- * Constructors and destructors
- *********************************************************/
-
- WButton();
-
- ~WButton();
-
- /**************************************************************
- * Properties
- **************************************************************/
-
- // AutoSize
-
- virtual WBool SetAutoSize( WBool on );
- virtual WBool GetAutoSize() const;
-
- /**************************************************************
- * Methods
- **************************************************************/
-
- // AutoSize
- //
- // Invoked when autosizing needs to be done
-
- virtual WBool AutoSize();
-
- /**************************************************************
- * Overrides
- **************************************************************/
-
- virtual const WChar * InitializeClass();
-
- virtual WStyle GetDefaultStyle() const;
-
- virtual WBool ProcessCommand( WUInt id, WNotify code,
- WNotifyInfo info, WLong & returns );
-
- virtual WBool SetText( const WString & text );
-
- virtual WBool SetFont( const WFont & font, WBool preserveSize=TRUE );
-
- virtual WBool WantsDragMessage( WULong whichButton ) const;
-
- /**************************************************************
- * Data members
- **************************************************************/
-
- private:
- WBool _autoSize;
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WBUTTON_HPP_INCLUDED
-